<div th:fragment="header">
    <div class="fly-header layui-bg-black">
        <div class="layui-container">
            <ul class="layui-nav fly-nav layui-hide-xs">
                <li class="layui-nav-item layui-this" th:each="item:${menu}">
                    <a th:href="@{${item.url}}"><i th:class="${item.icon}"></i>[[${item.name}]]</a>
                </li>
            </ul>
            <!-- 未登入的状态 -->
            <ul class="layui-nav fly-nav-user" th:if="${user == null}">
                <li class="layui-nav-item">
                    <a class="iconfont icon-touxiang layui-hide-xs" th:href="@{/front/login}"></a>
                </li>
                <li class="layui-nav-item">
                    <a th:href="@{/front/login}">登入</a>
                </li>
            </ul>
            <!-- 登入后的状态 -->
            <ul class="layui-nav fly-nav-user" th:if="${user != null}">
                <li class="layui-nav-item">
                    <a class="fly-nav-avatar" href="javascript:;">
                        <cite class="layui-hide-xs" th:text="${user.realName}"></cite>
                        <img src="https://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg">
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a href="/users/index">用户中心</a></dd>
                        <dd><a href="/users/order">我的订单</a></dd>
                        <dd><a href="/users/release">我的发布</a></dd>
                        <dd><a href="/users/notice">通知信息</a></dd>
                        <hr style="margin: 5px 0;">
                        <dd><a th:onclick="logout()" style="text-align: center;">退出</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>
</div>